/* brief GLSL vertex attributes

		So, basically, this class will be used to determine the overall "structure" of the application vertex
		Standard is to have the vertex position, color, normal and some uv's, but It could be whatever, according
		to the developper need.
		This was move from a struct to a class to "automatized" some treatments by having a vector of vec4 *
		who could be proceed by the "Array()" method in Vertex, whatever number of attributes have  been specified  
 */
Attributes	=	function  (position, color, normal, texCoord)
{   
        this.m_Position		=	position;       /*!< Vertex's position in space */
        this.m_Color		=	color;          /*!< Vertex's Color             */
        this.m_Normal		=	normal;         /*!< Vertex's normal, very important for light and orientation  */
        this.m_Texcoord0	=	texCoord;       /*!< Uv, very important for texturing                           */

		/*!< This vector will store reference to all the Attributes. This will give more freedom
		    as the structure of attributes could then be modified if needed	*/
                                             
		this.m_Attributes 		= 	new Array();
		this.m_Attributes[0]	=	position;
		this.m_Attributes[1]	=	color;
		this.m_Attributes[2]	=	normal;
		this.m_Attributes[3]	=	texCoord;
}

Attributes.m_Index	=	new Array();        	/*!< Store GLSL attributes index      */
			
Attributes.Bind 	= function()
{
	gl.enableVertexAttribArray(Attributes.m_Index[0]);
	gl.enableVertexAttribArray(Attributes.m_Index[1]);
	gl.enableVertexAttribArray(Attributes.m_Index[2]);
	gl.enableVertexAttribArray(Attributes.m_Index[3]);

	gl.vertexAttribPointer(Attributes.m_Index[0], 	4, gl.FLOAT, false, 64, 0);
	gl.vertexAttribPointer(Attributes.m_Index[1], 	4, gl.FLOAT, false, 64, 4*4);
	gl.vertexAttribPointer(Attributes.m_Index[2], 	4, gl.FLOAT, false, 64, 4*4*2);
	gl.vertexAttribPointer(Attributes.m_Index[3], 	4, gl.FLOAT, false, 64, 4*4*3);
}
			
Attributes.UnBind	=	function()
{
	gl.disableVertexAttribArray(Attributes.m_Index[0]);
	gl.disableVertexAttribArray(Attributes.m_Index[1]);
	gl.disableVertexAttribArray(Attributes.m_Index[2]);
	gl.disableVertexAttribArray(Attributes.m_Index[3]);
}